package ltd.hyangyang.rpc.core.remoting;

import io.netty.channel.Channel;
import io.netty.channel.ChannelHandlerContext;
import io.netty.channel.ChannelInboundHandlerAdapter;
import io.netty.channel.SimpleChannelInboundHandler;
import io.netty.handler.timeout.IdleStateEvent;

public class CustomHandler extends ChannelInboundHandlerAdapter {
    @Override
    public void userEventTriggered(ChannelHandlerContext ctx, Object evt) throws Exception {
        Channel channel = ctx.channel();
        if (evt instanceof IdleStateEvent){
            IdleStateEvent event = (IdleStateEvent) evt;

            switch (event.state()){
                case READER_IDLE:
                    HandlerReadIdel(channel);
                case WRITER_IDLE:
                    handlerWriterIdel(channel);
                case ALL_IDLE:
                    handlerAllIdle(channel);
            }
        }
    }

    public void handlerAllIdle(Channel channel) {

    }

    public void handlerWriterIdel(Channel channel) {

    }

    public void HandlerReadIdel(Channel channel) {
    }

}

